import request from "@/utils/request";

export function getChallengeRecord() {
  return request({
    url: "/keyboardGame/getChallengeRecord",
    method: "get",
  });
}

export function addKeyboardChallengeRecord(data) {
  return request({
    url: "/keyboardGame/addKeyboardChallengeRecord",
    method: "post",
    data,
  });
}

export function addChallengeRecord(data) {
  return request({
    url: "/keyboardGame/addChallengeRecord",
    method: "post",
    data,
  });
}

export function getWordList(params) {
  return request({
    url: "/englishGrammar/findEnglishGameList",
    method: "get",
    params,
  });
}
export function getWordNum(params) {
  return request({
    url: "/englishGrammar/countWord",
    method: "post",
    params,
  });
}
// 接受游戏完成结果
export function postGameResult(params) {
  return request({
    url: "/englishGrammar/updateGame",
    method: "get",
    params,
  });
}
// 加体力
export function addEnergy(params) {
  return request({
    url: "/studentEnergy/add",
    method: "post",
    params,
  });
}
// 记录学生离线时间
export function updateLeave(data) {
  return request({
    url: "/leave/updateLeave",
    method: "post",
    data,
  });
}
// 获取上次离线时间
export function getLevelTime(params) {
  return request({
    url: "/leave/findLeave",
    method: "post",
    params,
  });
}
// 上线添加体力
export function addEnergyOnline(params) {
  return request({
    url: "/studentEnergy/addEnergyByDay",
    method: "post",
    params,
  });
}
// 开始游戏扣体力
export function decreaseEnergy(params) {
  return request({
    url: "/englishGrammar/deductEnergy",
    method: "post",
    params,
  });
}

// 消消消游戏
export function getGameWordList(params) {
  return request({
    url: "/englishGrammar/findEnglishGameWordList",
    method: "get",
    params,
  });
}
